package com.ostrich.cloud.ostrichUserWeb.client;

import com.ostrich.cloud.common.result.Result;
import com.ostrich.cloud.ostrichUserWeb.client.orderparam.AddGoodsCarWebParam;
import com.ostrich.cloud.ostrichUserWeb.client.orderparam.AddKillWebParam;
import com.ostrich.cloud.ostrichUserWeb.client.orderparam.CreateWebParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;


/**
* name是项目名，contextId是client的名字
*/
@FeignClient(contextId = "orderManagerWebClient",name="ostrichUserWeb")
public interface OrderWebManagerClient {

    //创建订单
    @PostMapping("create")
    @ApiOperation("创建订单")
    Result createOrder(@RequestBody CreateWebParam param) ;


    //用户查看订单
    @GetMapping("customerSearch")
    @ApiOperation("用户查看订单")
    Result customerSearch(@RequestParam("orderNo") Long orderNo);

    //修改订单状态
    @GetMapping("changeStatus")
    @ApiOperation("付钱")
    String changeOrderStatus(@RequestParam("orderNo") Long orderNo,@RequestParam("payType") Integer payType);

    //删除购物车详情表
    @DeleteMapping("delCar")
    @ApiOperation("删除购物车内容")
    Result delCar(@RequestParam("goodsId") int goodsId,@RequestParam("goodsNum") int goodsNum);

    //添加新物品进入购物车
    @PostMapping("addCar")
    @ApiOperation("加入购物车")
    Result addCar(@RequestBody AddGoodsCarWebParam param) ;


    //查看购物车物品
    @GetMapping("goods")
    @ApiOperation("查看购物车")
    Result searchGoods(@RequestParam("current") Integer current, @RequestParam("size") Integer size);

    //取消订单
    @PutMapping("calOrder")
    @ApiOperation("取消订单")
    Result calOrder(@RequestParam("orderNo")Long orderNo) throws IOException;
    @GetMapping("getUserAllOrder")
    @ApiOperation("查询用户所有订单")
    Result getAllOrder();
    @PutMapping("finishedDeliveryOrder")
    public Result finisherOrder(@RequestParam("orderNo") Long orderNo);
}
